﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using FF.Method;
using FF.Entity;

namespace FF
{
    public partial class FormLogin : Form
    {
        public FormLogin()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBoxName.Text == "")
            {
                MessageBox.Show("用户名不能为空！");
                return;
            }
            if (textBoxPassword.Text == "")
            {
                MessageBox.Show("密码不能为空！");
                return;
            }
            User user = UserMethod.getUserByPasswordAndName(textBoxName.Text.Trim(),textBoxPassword.Text.Trim());
            if(user == null)
            {
                MessageBox.Show("登录失败！");
            }else
            {
                FormMain frm = new FormMain(user);
                frm.Show();
                this.Hide();
            }
        }

        private void FormLogin_Load(object sender, EventArgs e)
        {
            
            //SQLiteHelper.addDbPassword();
        }
    }
}
